home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / cmln1185.arc / CURVES3.LTG < prev    next >
Text File  |  1986-02-27  |  2KB  |  59 lines

  1.  
  2.                             Listing 3
  3.  
  4.       subroutine matmul( m1, m2, m3 )
  5.         real m1(3,3), m2(3,3), m3(3,3), temp(3,3)
  6.  
  7. c temp = m1 * m2. áWe use a temp array so that m3 may be the same as m1.
  8.         do 30 i = 1, 3
  9.            do 20 j = 1, 3
  10.               temp(i,j) = 0
  11.               do 10 k = 1, 3
  12.                  temp(i,j) = temp(i,j) + m1(i,k) * m2(k,j)ì
  13. 10 ááááááááááácontinueì
  14. 20 áááááááácontinueì
  15. 30 ááááácontinue
  16.  
  17. c m3 = temp
  18.         do 50 i = 1, 3
  19.            do 40 j = 1, 3
  20.               m3(i,j) = temp(i,j)ì
  21. 40 áááááááácontinueì
  22. 50 ááááácontinue
  23.       end
  24. è      subroutine blend( spline )
  25.         real spline(3,3), Bmat(3,3)
  26.  ááááááádata Bmat / 2, -3, 1, -4, 4, 0, 2, -1, 0 /
  27.  
  28.         call matmul( spline, blend, spline )
  29.       end
  30.  
  31.       subroutine eval( spline, t, point )
  32.         real spline(3,3), t, point(3), tv(3)
  33.  
  34.         tv(1) = t*t
  35.         tv(2) = t
  36.         tv(3) = 1ì
  37. c point = tv * spline
  38.         do 20 i = 1, 3
  39.            point(i) = 0
  40.            do 10 j = 1, 3
  41.               point(i) = point(i) + tv(j) * spline(j,i)ì
  42. 10 áááááááácontinueì
  43. 20 ááááácontinue
  44.       end
  45.  
  46.       subroutine draw( spline )
  47.         real spline(3,3), t, point(3)
  48.  
  49.         call blend( spline )
  50.         t = 0
  51.         call eval( spline, t, point )
  52.         call move( point )
  53.         do 10 i = 1, 10
  54.            t = t + .1
  55.            call eval( spline, t, point )
  56.            call draw( point )ì
  57. 10 ááááácontinue
  58.       end
  59.